package com.example.datlichkham;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateTime {
    private String title;
    private String desciption;
    private Date date;
    private Date hour;
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getDesciption() {
        return desciption;
    }
    public void setDesciption(String desciption) {
        this.desciption = desciption;
    }
    public Date getDate() {
        return date;
    }
    public void setDate(Date date) {
        this.date = date;
    }
    public Date getHour() {
        return hour;
    }
    public void setHour(Date hou) {
        this.hour = hour;
    }
    public DateTime(String title, String desciption, Date date,
                     Date hour) {
        super();
        this.title = title;
        this.desciption = desciption;
        this.date = date;
        this.hour = hour;
    }
    public DateTime() {
        super();
    }

    public String getDateFormat(Date d)
    {
        SimpleDateFormat dft=new
                SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
        return dft.format(d);
    }

    public String getHourFormat(Date d)
    {
        SimpleDateFormat dft=new
                SimpleDateFormat("hh:mm a", Locale.getDefault());
        return dft.format(d);
    }
    @Override
    public String toString() {
        return this.title+"-"+
                getDateFormat(this.date)+"-"+
                getHourFormat(this.hour);
    }
}

